<template>
  <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
    <el-tab-pane label="选人员" name="first">
      <div class="t-l">
        <el-radio-group v-model="radio5" size="small">
          <el-radio-button label="1">所有人员</el-radio-button>
          <el-radio-button label="2">按部门</el-radio-button>
          <el-radio-button label="3">按岗位</el-radio-button>
          <el-radio-button label="4">按用户组</el-radio-button>
          <el-radio-button label="5">按常用联系人</el-radio-button>
        </el-radio-group>
      </div>
      <el-transfer
        style="text-align: left; display: inline-block"
        v-model="value3"
        filterable
        :left-default-checked="[2, 3]"
        :right-default-checked="[1]"
        :render-content="renderFunc"
        :titles="['Source', 'Target']"
        :button-texts="['到左边', '到右边']"
        :format="{
          noChecked: '${total}',
          hasChecked: '${checked}/${total}'
        }"
        @change="handleChange"
        :data="data">
        <el-button class="transfer-footer" slot="left-footer" size="small">操作</el-button>
        <el-button class="transfer-footer" slot="right-footer" size="small">操作</el-button>
      </el-transfer>
    </el-tab-pane>
    <el-tab-pane label="选部门" name="second">选部门</el-tab-pane>
    <el-tab-pane label="选岗位" name="third">选岗位</el-tab-pane>
    <el-tab-pane label="选用户组" name="fourth">选用户组</el-tab-pane>
    <el-tab-pane label="选常用联系人" name="five">选常用联系人</el-tab-pane>
  </el-tabs>
</template>

<script>
export default {
  data() {
    const generateData = _ => {
      const data = [];
      for (let i = 1; i <= 15; i++) {
        data.push({
          key: i,
          label: `备选项 ${ i }`,
          disabled: i % 4 === 0
        });
      }
      return data;
    }
    return {
      activeName: 'first',
      radio5:'1',
      data: generateData(),
      value3: [1],
      value4: [1],
      renderFunc(h, option) {
        return <span>{ option.key } - { option.label }</span>;
      }
    };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    handleChange(value, direction, movedKeys) {
        console.log(value, direction, movedKeys);
      }
  }
}
</script>

<style scoped>
.t-l{
  text-align: left;
}
</style>
